﻿using System.Security.Principal;
using System.Web.Security;

namespace FacialClub
{
    /// <summary>
    /// Facial Club Identity
    /// </summary>
    public class FacialClubIdentity : IIdentity
    {
        private readonly FormsAuthenticationTicket _ticket;

        /// <summary>
        /// Facial Club Identity Constructor
        /// </summary>
        /// <param name="ticket"></param>
        public FacialClubIdentity(FormsAuthenticationTicket ticket)
        {
            this._ticket = ticket;
        }

        /// <summary>
        /// Friendly Name
        /// </summary>
        public string FriendlyName
        {
            get { return _ticket.UserData; }
        }

        #region IIdentity Members

        /// <summary>
        /// Authentication Type
        /// </summary>
        public string AuthenticationType
        {
            get { return "FacialClub"; }
        }

        /// <summary>
        /// Returns Authentication Status
        /// </summary>
        public bool IsAuthenticated
        {
            get { return true; }
        }

        /// <summary>
        /// Returns Name
        /// </summary>
        public string Name
        {
            get { return _ticket.Name; }
        }

        #endregion
    }
}